package cn.gmph.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.mysql.jdbc.StringUtils;

import cn.gmph.core.base.BaseController;

@Controller
public class IndexController extends BaseController {

    /**
     * 进入首页
     * @param rep
     * @param res
     * @return
     */
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index() {

        //        Object obj = getSessionUser();
        //        if (null == obj) {
        //            return "forward:/idx";
        //        }
        return "redirect:/index.html";
    }

    public String getLastList(@RequestParam String p, @RequestParam String author) {

        String cpath = request.getContextPath();
        if (!StringUtils.isNullOrEmpty(p)) {
            return "forward:" + cpath + "/press/#/contentArchives/" + p;

        }
        if (!StringUtils.isNullOrEmpty(author)) {
            return "forward:" + cpath + "/press/#/contentArchives/" + author;
        }
        return "forward:" + cpath + "/press";
    }

}
